<%-- 
    Document   : index
    Created on : Mar 9, 2013, 1:11:46 PM
    Author     : duonghung1369
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib tagdir="/WEB-INF/tags/common/" prefix="common" %>
<%@taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE html>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Antique Shop</title>
        <link rel="stylesheet" type="text/css" href="../resource/css/style.css" >
        <script src="../resource/js/common.js" type="text/javascript" ></script>
        <script src="../resource/js/ajaxfunctions.js" type="text/javascript" ></script>
        <script src="../resource/js/storage.js" type="text/javascript" ></script>
        <script src="../resource/js/validation.js" type="text/javascript" ></script> 
        <script type="text/javascript">
            window.onload = function(e){
                updateIndexPage();
                loadProductsXmlFromServer();
            }
        </script>
    </head>
    <body>
        <div class="antiqueshop-container">
            <div class="container">
                <div id="header">
                    <common:header />
                    <common:login_logout />
                </div>
                <div id="navigation">
                    <common:navigation />
                </div>
                <div id="column-left">
                    <common:category />
                </div>                
                <div id="content">
                    <s:iterator value="products" status="productStatus" id="product">
                        <div class="product-block">
                            <s:if test="#session.logined == true">
                                <s:if test="#session.isadmin == false">
                                    <div class="add-to-cart hidden">
                                        <a href="javascript:void(0)" onclick="addCart(<s:property value="id" />, '<s:property value="name" />', '<s:property value="description" />', <s:property value="quantity" />, <s:property value="price" />, '<s:property value="images[0].url" />', this);"></a>
                                        <!--a href="#" onclick="ajaxAddToCart(<!--s:property value="id"/>, '<--s:property value="name"/>', '<--s:property value="description"/>', '<--s:property value="price"/>')">Add to cart</a-->
                                    </div>
                                </s:if>
                            </s:if>
                            <s:else>
                                <div class="add-to-cart hidden">
                                    <a href="javascript:void(0)" onclick="addCart(<s:property value="id" />, '<s:property value="name" />', '<s:property value="description" />', <s:property value="quantity" />, <s:property value="price" />, '<s:property value="images[0].url" />', this);"></a>
                                    <!--a href="#" onclick="ajaxAddToCart(<!--s:property value="id"/>, '<--s:property value="name"/>', '<--s:property value="description"/>', '<--s:property value="price"/>')">Add to cart</a-->
                                </div>
                            </s:else>
                            <div class="product-block-image">
                                <s:if test="#product.images.size() > 0">
                                    <s:iterator status="imageStatus" value="images" id="image">
                                        <s:if test="!#image.isBigsize">
                                            <a href="../product/detail.html?id=<s:property value="#product.id" />"><img src="<s:property value="url" />" alt="product image" /></a>
                                            </s:if>
                                        </s:iterator>
                                    </s:if>
                                    <s:else>
                                    <a href="../product/detail.html?id=<s:property value="id" />"><img src="" alt="product image" /></a>
                                    </s:else>
                            </div>
                            <div style="position: absolute; bottom: 0">
                                <a class="product-block-information" href="../product/detail.html?id=<s:property value="id" />">
                                    <div class="item-information">
                                        <p class="item-information-name"><s:property value="name" /></p>
                                        <p class="item-information-price">Product price ($): <s:property value="price" /></p>
                                        <p>Product Quantity: <span class="item-information-quantity"><s:property value="quantity" /></span></p>
                                        <p class="item-information-id" style="display: none"><s:property value="id" /></p>
                                    </div>
                                </a>
                            </div>
                        </div>
                    </s:iterator>
                </div>
                <div id="footer">
                    <common:footer />
                </div>
            </div>
        </div>
    </body>
</html>
